﻿
 
 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		
		<title>jb-aptech毕业设计项目</TITLE>
<meta name="renderer" content="ie-comp">
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<link href="../../css/style.css" rel="stylesheet" type="text/css">
		<link rel="stylesheet" href="../../css/menu.css">

		<script src="../../script/jquery-3.3.1.min.js"></script>
		<script src="../../script/common.js"></script>
		<script src="../../../js/bootstrap.min.js"></script>
		<script src="../../../js/vue.js"></script>
	</head>
  <body>
  <div id="up">
   		<div class="page_title">
			权限管理 > 用户管理 > 系统角色管理 > 编辑角色
		</div>

			<div class="button_bar">
	   		<button class="common_button" onclick="help('');">帮助</button>
	   		<button class="common_button" onclick="back();">返回</button>
			<button class="common_button" @click="update()">保存</button>
	   	</div>
	   	<table class="query_form_table">
	   		<tr>
	   			<th>编号</th>
	   			<td>
	   				<input type="text"  size="20" v-model="role.role_id" readonly="readonly">
	   			</td>
	   			<th>角色名</th>
	   			<td>
	   				<input type="text" v-model="role.role_name" size="20" >
	   			</td>
	   		</tr>
	   		<tr>
	   			<th>角色描述</th>
	   			<td>
	   				<textarea v-model="role.role_desc" cols="20" rows="3"></textarea>
	   			</td>
	   			<th>状态</th>
	   			<td>
					<select v-model="role.role_flag">
						<option value="1">正常</option>
	   					<option value="0">禁用</option></select>
	   			</td>
	   		</tr>
	   	</table>
  </div>
  </body>
<script>
	var app = new Vue({
		el:'#up',
		data:{
            role:{
                role_id:'',
                role_name:'',
                role_desc:'',
                role_flag:'',
            }
		},
		methods:{
		    update(){
                if(this.role.role_name==''||null){
                    alert("必填项存在空值！")
                    return
                }
                $.getJSON("/updateSysRole",this.role,function (json) {
					if(json.code==200){
						alert("编辑成功！！！")
						location='list.html'
					}else {
					    alert("服务器异常")
					}
                });
			}

		},
		created(){
		    let id = sessionStorage.getItem("rid");
		    $.getJSON("/querySysRoleById/"+id,function (json) {
				app.role=json.data.obj;
            });
		}
	})
</script>
</html>

